package customer_manage_main;

import java.util.LinkedList;

import customer_manage_database.Customer;
import customer_manage_function_implementation.AddCustomer;
import customer_manage_function_implementation.DeleteCustomer;
import customer_manage_function_implementation.LookOverCustomer;
import customer_manage_function_implementation.OrderCustomer;
import customer_manage_function_implementation.UpdateCustomer;

public class MainMenu {	
	public void showAllCustomers(LinkedList<Customer> lList){
		if (lList.size()!=0) {
			for (int i = 0; i < lList.size(); i++) {
				System.out.println("ID:"+lList.get(i).getID()+",name:"+
					lList.get(i).getName()+",sex:"+lList.get(i).getSex()+",birthday:"+
					lList.get(i).getBirthday()+",address:"+lList.get(i).getAddress()+
					",call:"+lList.get(i).getCall());	
			}
			
		}else {
			System.out.println("There is no customer!!!");
		}
		
		
		
	}

	public void mainMenu(char menu, String[] dealParameter,
			LinkedList<Customer> clist) {
		// TODO Auto-generated method stub

		switch (menu) {
		case 'L':
			LookOverCustomer loc=new LookOverCustomer();
			loc.checkCustomer(dealParameter, clist);
			break;
		case 'A':
			AddCustomer addc=new AddCustomer();
			clist=addc.addCustomer(dealParameter, clist);
			showAllCustomers(clist);
			break;
		case 'D':
			DeleteCustomer dc=new DeleteCustomer();
			clist=dc.deleteCustomer(dealParameter, clist);
            showAllCustomers(clist);
			break;
		case 'U':
			UpdateCustomer uc=new UpdateCustomer();
			clist=uc.UpdateCustomer(dealParameter, clist);
			showAllCustomers(clist);
			break;
		case 'O':
			OrderCustomer oc=new OrderCustomer();
			clist=oc.orderCustomers(dealParameter, clist);
			showAllCustomers(clist);
			break;
		case 'H':
			System.out.println("********************查看帮助    性别0男1女********************");
			System.out.println("---------有参查看L NAME              无参查看L----------------");
			System.out.println("添加客户A id:xx,name：xx,sex:xx,birthday:xx,address:xx,call:xx");
			System.out.println("删除客户D xx(客户ID)                      ");
			System.out.println("修改客户信息U id:xx(必需),name：xx,sex:xx......               ");
			System.out.println("排序O ID/NAME（升序排列）                                                                             ");
			System.out.println("查看帮助H                                            退出程序Q");
			
			break;
		case 'Q':
			System.exit(0);
			break;

		default:
			break;
		}
		
	
		
	}


}
